package com.server.server;

import com.server.executor.pool.OrderControlThreadPoolExecutor;
import com.server.server.UdpNettyServer;
import com.server.server.WebSocketNettyServer;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Description: This is a sample class.
 *
 * @Author Simon
 */
@Slf4j
public class NettyAppLauncher {
    public static void startServer() {
        log.info("启动Netty中");
        ThreadPoolExecutor orderThreadPool = OrderControlThreadPoolExecutor.getInstance();

        CompletableFuture<Void> WebsocketFutureTask = CompletableFuture.runAsync(
                WebSocketNettyServer::start
        ,orderThreadPool);

        CompletableFuture<Void> UdpFutureTask = CompletableFuture.runAsync(
                UdpNettyServer::start
        ,orderThreadPool);

        log.info("Netty启动完毕");
    }

}
